import { request } from '@/utils/request'
// @ts-ignore
import { departments, addDepartments, SimpleUser } from '@/types/departments'

// 获取部门列表
export const getDepartmentsApi = () => {
  return request<departments>('/company/department')
}

// 删除部门详情 不需要传返回的数据类型
export const delDepartmentsApi = (id: string) => {
  return request(`/company/department/${id}`, 'DELETE')
}

// 获取负责人接口
export const getSimpleUserListApi = () => {
  return request<SimpleUser[]>('/sys/user/simple')
}

// 新增部门 不需要返回数据类型
export const addDepartmentsApi = (data: addDepartments) => {
  return request('/company/department', 'POST', data)
}

// 获取部门详情
export const getDepartmentsDetailApi = (id: string) => {
  return request<addDepartments>(`/company/department/${id}`)
}

// 更新部门详情
export const updateDepartmentsApi = (data: addDepartments) => {
  return request(`/company/department/${data.id}`, 'PUT', data)
}
